//
//  TravelPersonsCell.m
//  ImGuider
//
//  Created by 王鹏宇 on 2017/12/13.
//  Copyright © 2017年 AudioCtrip. All rights reserved.
//

#import "TravelPersonsCell.h"
#import "PersonCell.h"
@implementation TravelPersonsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    [self.travelPersonsTabelView registerNib:[UINib nibWithNibName:@"PersonCell" bundle:nil] forCellReuseIdentifier:@"PersonCell"];
    
    self.travelPersonsTabelView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.selectionStyle =  UITableViewCellSelectionStyleNone;
    self.travelPersonsTabelView.scrollEnabled = NO;
    
    self.travelPersonLabel.textColor = kSubitleColor;
    self.travelPersonLabel.text = MYLocalizedString(@"TICKET_USER_INFOR", nil);
}

- (void)setDataSource:(NSMutableArray *)dataSource {
    
    _dataSource = [NSMutableArray arrayWithArray:dataSource];
    if (_dataSource.count == 0) {
        self.travelPersonLabel.text = @"";
    }
    [self.travelPersonsTabelView reloadData];
}




- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return self.dataSource.count;
}


- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    PersonCell * cell = [tableView dequeueReusableCellWithIdentifier:@"PersonCell"];
    
    TicketMemberInfoModel * model = self.dataSource[indexPath.row];
    
    [cell configDataWith:model];
    
    return cell;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 50;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
